<h1>User's profile</h1>
<%= link_to 'Back',root_url%>
<table>
	<tr>
		<td width='100'>Email</td><td><%= session[:user].email %></td>
	</tr>
	<tr>
		<td width='100'>Full Name</td><td><%= session[:user].fullname %></td>
	</tr>
	<tr>
		<td width='100'>Phone</td><td><%= session[:user].phone %></td>
	</tr>
	<tr>
		<td width='100'>Address</td><td><%= session[:user].address %></td>
	</tr>
	<tr>
		<td width='100'>ID number</td><td><%= session[:user].idnumber %></td>
	</tr>
</table>
<hr/>
<h1>Borrow History</h1>
<% borrows = Borrow.find(:all,:conditions => ["user_id = ?",session[:user]]) %>
<% if borrows %>
<table>
	<thead style="color:black;font-weight:bold;">
		<tr>
		<td>
			Book Title
		</td>
		<td>
			Borrowed date
		</td>
		<td>
			Return Date
		</td>
		<td>
			Deposit
		</td>		
		</tr>
	</thead>
	<% borrows.each do |borrow|%>
	<% book = Book.find(borrow.book_id)%>
	<tr>
		<td width=400>
			<%= book.title %>
		</td>
		<td width = 200>
			<%= borrow.borrowed_date %>
		</td>
		<td width = 200>
			<%= borrow.return_date %>
		</td>
		<td>
			<%= borrow.deposit %>
		</td>
	</tr>
	<% end%>
</table>
<% else %>
	You do not borrow any books
<% end%>
